package com.klz.iblog.service.serviceImpl;

import com.klz.iblog.dao.TypeMapper;
import com.klz.iblog.pojo.Type;
import com.klz.iblog.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TypeServiceImpl implements TypeService {

    @Autowired(required = false)
    private TypeMapper typeMapper;


    /**
     * 查询所有的父类型信息
     * @param typeParentId
     * @return
     */
    @Override
    public List<Type> selectAllparentTypeInfo(Integer typeParentId) {
        return typeMapper.selectAllparentTypeInfo(typeParentId);
    }

    /**
     * 根据父类型id,查询子类型信息
     * @param typeParentId
     * @return
     */
    @Override
    public List<Type> selectTypeInfoByParentId(Integer typeParentId) {
        return typeMapper.selectTypeInfoByParentId(typeParentId);
    }

    /**
     * 根据类型id,查询博客列表信息
     * @param typeId
     * @return
     */
    @Override
    public List<Type> selectBlogListInfoByType(Integer typeId) {
        return typeMapper.selectBlogListInfoByType(typeId);
    }

    /**
     * 根据类型id,查询博客列表信息,按浏览量排序
     * @param typeId
     * @return
     */
    @Override
    public List<Type> selectBlogListInfoByTypeAndBrowseNum(Integer typeId) {
        return typeMapper.selectBlogListInfoByTypeAndBrowseNum(typeId);
    }
}
